from selenium import webdriver
from time import sleep
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains

# 打开浏览器
driver = webdriver.Firefox()
# 双击打开百度页面
driver.get('https://www.jiuxian.com/')
sleep(2)
# 窗口最大化
driver.maximize_window()
sleep(2)
# 点击请登录
driver.find_element(By.CLASS_NAME, 'headerLogin').click()
sleep(2)
# 输入手机号
driver.find_element(By.ID, 'userName').send_keys('15985645480')
sleep(2)
# 输入密码
driver.find_element(By.ID, 'password').send_keys('gW09092434')
# 强制等待 用户点击图片输入验证码
sleep(20)
# 点击登录按钮
driver.find_element(By.NAME, 'bi_Usuallogin').click()
sleep(2)
# 点击确认
driver.find_element(By.ID, 'bindSub').click()
sleep(5)
seach1 = driver.find_element(By.TAG_NAME, 'input')
seach1.send_keys('国台')
sleep(2)
seach1.send_keys(Keys.ENTER)
sleep(2)
# 点击进入店铺
driver.find_element(By.XPATH, '//a[@href=" http://shop.jiuxian.com/brand-20.htm "]').click()
sleep(2)
driver.switch_to.window(driver.window_handles[-1])
sleep(2)
driver.execute_script('window.scrollTo(0, 1300)')
sleep(2)
driver.find_element(By.XPATH, '//area[@href="http://www.jiuxian.com/goods-28877.html"]').click()


sleep(10)






